#pragma once

#include "Color.h"
#include "HCoordinates.h"
#include <GL/glew.h>

namespace cagd
{
    class DirectionalLight
    {
    protected:
        GLenum      _light_index;
        HCoordinate _position;
        Color       _ambient_intensity, _diffuse_intensity, _specular_intensity;

        Color _ambient_black;
        Color _default_black;

    public:
        DirectionalLight(GLenum             light_index,
                         const HCoordinate  &position,
                         const Color        &ambient_intensity,
                         const Color        &diffuse_intensity,
                         const Color        &specular_intensity);

        void Enable();
        void Disable();
        void SwitchLight(GLboolean on);
    };

    class PointLight : public DirectionalLight
    {
    protected:
        GLfloat _constant_attenuation,
                _linear_attenuation,
                _quadratic_attenuation;

    public:
        PointLight(GLenum               light_index,
                   const HCoordinate    &position,
                   const Color          &ambient_intensity,
                   const Color          &diffuse_intensity,
                   const Color          &specular_intensity,
                   GLfloat              constant_attenuation,
                   GLfloat              linear_attenuation,
                   GLfloat              quadratic_attenuation);
    };

    class SpotLight : public PointLight
    {
    private:
        HCoordinate _spot_direction;
        GLfloat     _spot_cutoff, _spot_exponent;

    public:
        SpotLight(GLenum               light_index,
                  const HCoordinate    &position,
                  const Color          &ambient_intensity,
                  const Color          &diffuse_intensity,
                  const Color          &specular_intensity,
                  GLfloat              constant_attenuation,
                  GLfloat              linear_attenuation,
                  GLfloat              quadratic_attenuation,
                  const HCoordinate    &spot_direction,
                  GLfloat              spot_cutoff,
                  GLfloat              spot_exponent);
    };
}
